package com.hjqjl.whapplib.net;

import android.util.ArrayMap;

import com.hjqjl.whapplib.model.GetJoke;
import com.mp5a5.www.library.use.RetrofitFactory;

import java.util.HashMap;

import io.reactivex.Flowable;
import io.reactivex.Observable;

public class HttpMethods {

    private ApiService apiService;

    private HttpMethods() {
        apiService = RetrofitFactory.getInstance().create(ApiService.class);
    }

    public static HttpMethods getInstance() {
        return HttpMethodsHolder.S_INSTANCE;
    }

    private static class HttpMethodsHolder {
        private static final HttpMethods S_INSTANCE = new HttpMethods();
    }

//    public Flowable<NBAKTEntity> getJFNBAInfo(String key) {
//        ArrayMap<String, Object> map = new ArrayMap<>();
//        map.put("key", key);
//        return nbaApiT.getNBAJFTInfo(map);
//    }

    public Observable<GetJoke> getJoke(String count) {
        ArrayMap<String, Object> map = new ArrayMap<>();
        map.put("page", "1");
        map.put("count", count);
        map.put("type", "video");
        return apiService.getJoke(map);
//                .map(new RxFunction<>());
    }
}
